package graphroute

import (
	"power/core/localwrap"
	"power/core/service/graphs"

	"github.com/RocksonZeta/irisx"
	"github.com/kataras/iris/v12"
)

var logGraphs = localwrap.GetLogger().Fork("power/http/graphroute", "RouteGraphs")

//Route{serviceName}
func routeGraph(party iris.Party) {
	party.Get("/", func(ctx iris.Context) {
		c := ctx.(*irisx.Context)
		id := c.CheckQuery("id").NotEmpty().Int(0)
		uid := c.GetUidInt()
		logProjects.Debug().Str("path", c.Path()).Int("id", id).Int("uid", uid).Send()
		r := graphs.Graphs{}.Get(id)
		c.Ok(r)
	})
}
